package com.ebt.m.proposal_v2.mvp.presenter;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

import com.ebt.m.AppContext;
import com.ebt.m.commons.utils.ActivityUtils;
import com.ebt.m.data.bean.UserInfo;
import com.ebt.m.proposal_v2.dao.request.ParamGetRisks;
import com.ebt.m.proposal_v2.mvp.base.BasePresenter;
import com.ebt.m.proposal_v2.mvp.contract.MainProductContract;
import com.ebt.m.proposal_v2.ui.SearchProductsActivity;

/**
 * @author archer.qi
 *         Created on 2017/5/22.
 */
public class MainProductPresenter extends BasePresenter<MainProductContract.View> implements MainProductContract.Presenter {
    /* 经贷公司*/
    public static final int COMPANY_TYPE_CRE = 2;
    /* 保险公司*/
    public static final int COMPANY_TYPE_INS = 1;

    public MainProductPresenter(Context context, MainProductContract.View view) {
        super(context, view);
    }

    @Override
    public void start() {

    }

    @Override
    public void doSearch(Activity activity) {
        ParamGetRisks mArg = mView.getArgument();
        Bundle data = new Bundle();
        data.putSerializable(SearchProductsActivity.ARG_PARAM, mArg);
        ActivityUtils.launchActivity(activity, SearchProductsActivity.class, data);
    }

    @Override
    public int getCompanyType() {
        UserInfo.CompanyInfo ci = AppContext.getCurrentUser().getCompanyInfo();
        if (ci == null) {
            return 1;
        }
        return ci.getCategory();
    }
}
